package com.example.mingyue.Exception;


import com.example.mingyue.common.Result;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExteptionHeader {

    @ExceptionHandler(Exception.class)
    public Result exteption(Exception e){
        e.printStackTrace();
        return Result.success(StringUtils.hasLength(e.getMessage())?e.getMessage():"操作失败");
    }
}
